<?php

	header("Content-Type: text/html;charset=utf-8"); 

	include("../function/_nosql.php");

	include("../function/function.php");
	$classid = chkstr(trim($_REQUEST['classid']));
	//检测变量是否为数字或数字字符串
	if(!$classid)$classid=135;
	if(is_numeric($classid)){
		
	

		$sql="select * from kboy_bigclass where id=$classid";

		$rows=mysql_query($sql);

		$nums=mysql_num_rows($rows);

		if($nums>0){

			$rs=mysql_fetch_array($rows);

			$bigclass_cn = $rs['bigclass_cn'];

		}else{

			echo erro("该信息不存在或已被删除1");

		}

	}else{

		echo erro("参数错误");

	}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title><?= $active_title.'_'.$web_titles ?></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="Keywords" content="<?= $web_keywords ?>" />
		<meta name="Description" content="<?= $web_description ?>" />
		<link rel="stylesheet" type="text/css" href="css/index.css"/>
		<script type="text/javascript" src="../js/baidutongji.js"></script>
		<script src="./js/jquery-1.10.2.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="wrap">
			<header>
				<div class="header">
					<div class="h-logo"><img src="./image/logo.png"/></div>
					<div class="h-panel">
						<p style="height: 30px;"></p>
						<img src="image/top_pic1.png"/>
						<img src="image/top_pic2.png"/>
					</div>
				</div>
				<nav>
					<a href="index.php">首页</a>
					<a href="huodong.php">活动</a>
					<a href="">资讯</a>
					<a href="shequ.php">社区</a>
					<a href="">步道</a>
				</nav>
			</header>
			<main>
				<section>
				</section>
				<section>
						<div class="liebiao">
							
							
							
							<ul class="tupian1" style="display: block;">
							<?php
								
								$order = intval($_GET['order']);

								  if($order==1 || $order == 0 ){

								   $orders = "active_center_time asc ";//出发时间

								  }

								   if($order==3){

								   $orders = " active_center_time asc ";//国内短线
									$line = "and active_tian <= 2 ";
								  }

								$prov = $_GET['prov'];
								if($prov=='国内长线')
								{
									$provs = "and active_end_prov != '国外' "; 
									$line = "and active_tian > 2 ";
								}
								if($prov=='国内')
								{
									$provs = "and active_end_prov != '国外' "; 
								}
								if($prov=='国外')
								{
									$provs = "and active_end_prov = '国外' ";
								}
								$news_sql = "select * from kboy_forum_active where active_top != '' and active_bigclass=$classid  and active_model = 0 and active_state != 2 ".$line."".$provs ;
								$news_rows = mysql_query($news_sql);
								
								$i = 1;
								while($news_rs = mysql_fetch_array($news_rows)){
										
						?>
								<li>
									<?php if($classid == 136) { ?>
									<a href="xiangqingDa.php?newsid=<?=$news_rs['id'];?>">
									<?php }else{ ?>
									<a href="xiangqing.php?newsid=<?=$news_rs['id'];?>">
									<?php } ?>
										<img src="../<?php 
	                                        		$news_rss = explode(',',$news_rs['active_pic']);
													if($news_rss){
														echo $news_rss[0];
													}else{
														echo $news_rs['active_pic'];
													}
	                                        	?>" width="150" height="100"/>
									<div class="zhuti">
										<p><<strong class="remen">热门</strong>><?=$news_rs['active_title']?></p>
										<p>
										出发时间：<?php echo date('Y年m月d日',strtotime($news_rs['active_start_time'],time()));?>
										</p>
										<p>
										徒步距离：<?php echo $news_rs['active_all_line']=!empty($news_rs['active_all_line'])?$news_rs['active_all_line']:0;?>km
											
										</p>
									</div>
									</a>
								</li>
						<?php } ?>
								<?php

								$SQL = " where active_bigclass=$classid  and active_model = 0 and active_top = '' and active_state != 2 ";
								

								if($start_time !='' and $end_time ==''){

								$SQL = $SQL." and date(active_start_time) >= '".$start_time."' ";

								}

								if($end_time!='' and $start_time==''){

								$SQL = $SQL." and date(active_start_time) <= '".$end_time."' ";

								}
								

								if($start_time !='' and $end_time !=''){

								$SQL = $SQL." and date(active_start_time) between '$start_time.' and '$end_time'";

								}
								
								
								

								if($search_text){

								$SQL = $SQL." and ( `active_end_prov` like '%".$search_text."%' or `active_end_city` like '%".$search_text."%'  or  `active_jingdian` like '%".$search_text."%' ) ";

								}

								 $order = intval($_GET['order']);

								  if($order==1 || $order == 0 ){

								   $orders = "active_center_time asc ";//出发时间

								  }

								   if($order==3){

								   $orders = "active_center_time asc ";//国内短线
									$line = "and active_tian <= 2 ";
								  }

								$prov = $_GET['prov'];
								if($prov=='国内长线')
								{
									$provs = "and active_end_prov != '国外' "; 
									$line = "and active_tian > 2 ";
								}
								if($prov=='国内')
								{
									$provs = "and active_end_prov != '国外' "; 
								}
								if($prov=='国外')
								{
									$provs = "and active_end_prov = '国外' ";
								}
								

								$pagesize = 10; // 分页数量
								
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值

								if($pageval){

									if(!is_numeric($pageval)){

										echo erro("Page Error");

									}

									if($pageval <= 1){

										$pageval = 1;

									}

									$page = ($pageval-1) * $pagesize;

									$page .= ",";

								}else{

									$pageval = 1;

								}
								$pagesql = "select * from kboy_forum_active ".$SQL."".$top."".$provs."".$line."order by active_state asc,".$orders;
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页

								if($pageval > $pagecount){

									$pageval = $pagecount;

								}

								

								$news_sql = $pagesql." limit $page $pagesize";
								
								$news_rows = mysql_query($news_sql);
								
								$i = 1;
								while($news_rs = mysql_fetch_array($news_rows)){
										
						?>
								<li>
									<?php if($classid == 136) { ?>
									<a href="xiangqingDa.php?newsid=<?=$news_rs['id'];?>">
									<?php }else{ ?>
									<a href="xiangqing.php?newsid=<?=$news_rs['id'];?>">
									<?php } ?>
										<img src="../<?php 
	                                        		$news_rss = explode(',',$news_rs['active_pic']);
													if($news_rss){
														echo $news_rss[0];
													}else{
														echo $news_rs['active_pic'];
													}
	                                        	?>" width="150" height="100"/>
									<div class="zhuti">
										<p><?=$news_rs['active_title']?></p>
										<p>
										出发时间：<?php echo date('Y年m月d日',strtotime($news_rs['active_start_time'],time()));?>
										</p>
										<p>
										徒步距离：<?php echo $news_rs['active_all_line']=!empty($news_rs['active_all_line'])?$news_rs['active_all_line']:0;?>km
											
										</p>
									</div>
									</a>
								</li>
								<?php
	
									}
	
							?>
							<?php
									
									if($pagenum > $pagesize){
	
										echo "<div class=\"pagination\"><ul>";
										
										if(isset($_GET['prov']))
										{
										$url = "huodong.php?classid=$classid&prov=$prov";
										}else{
											
										$url = "huodong.php?classid=$classid";//当前页面
										}
	
										pagebar($pagecount, $pageval, 2, $url);
	
										echo "</ul></div>";
	
									}
	
							?>
							</ul>
						</div>
				</section>
			</main>
		</div>
			<footer>
			        <nav class="navbar navbar-default navbar-fixed-bottom">
			            <div class="col-xs-12 btn-group" style="height: 50px;line-height: 50px;background-color: #EDF2F7 ;text-align: center;position: fixed ;width: 100%;bottom: 0;left: 0;">
			                <a href="index.php" style="width: 25%;font-size:16px;display: block;float: left;" class="col-xs-3 nopadding text-center bottomDiv">
			                	首页
			                </a> 
			
			                <a href="huodong.php" style="width: 25%;font-size:16px;display: block;float: left;" class="col-xs-3 nopadding text-center bottomDiv">
			               	活动
			                </a>
			
			                <a href="shequ.php" style="width: 25%;font-size:16px;display: block;float: left;" class="col-xs-3 nopadding text-center bottomDiv">
			             	 社区
			                </a>
			                
			                <a href="personal.php" style="width: 25%;font-size:16px;display: block;float: left;" class="col-xs-3 nopadding text-center bottomDiv">
			               	个人中心
			                </a>
			            </div>
			        </nav>
			    </footer>
	</body>
	<script type="text/javascript">
		var shu = $(".banner img").length;
		var c = 0;
		function run(){
			c++;
			if(c == 3){
				c = 0 ;
			}
			$(".banner img").eq(c).stop().fadeIn(300).siblings('img').stop().fadeOut(300);
			//让c号li变红，其他的变灰
//			$(".thumb img").eq(c).css({'opacity':'1'}).siblings('img').css({'opacity':'0.3'});
		}
														
			timer = setInterval(run,2000);
	</script>
	<script type="text/javascript">
		$(".hd-nav-wrap .xian").click(function(){
			$(this).css({"background":"#2260B4","color":"#fff"}).siblings(".xian").css({"background":"#fff","color":"#333"})
		var a =	$(this).index();
			$(".tupian1").eq(a).show().siblings(".tupian1").hide();
		})
	</script>
</html>
